<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="vue.js"></script>
</head>
<body>	
	<div id="app">
		<input ref="input" v-model="msg" type="text" v-on:keyup.enter="add">
		<ul>
			<li v-for="(json,i) in items">
				{{i}} : {{json.text}}
				<button @click="a(i)">X</button>
			</li>
		</ul>
	</div>
</body>
<script type="text/javascript">
new Vue({
  el: '#app',
  data: {//数据
  	msg:"",
    items: [
      { text: '内容1' },
      { text: '内容2' },
      { text: '内容3' },
      { text: '内容4' },
      { text: '内容5' }
    ]
  },
  methods:{//方法
  	add:function (e) {
  		// console.log(this.$refs.input.value);
  		// var msg = this.$refs.input.value;
  		// var msg = e.target.value;
  		this.items.push({text:this.msg})
  		this.msg = "";
  	},
  	a:function(i){
  		this.items.splice(i,1)
  	}
  }
})
</script>
</html>